package com.dt76.smallloanbackendservice.controller.xm;

import com.dt76.smallloanbackendservice.pojo.xm.BeforeOrder;
import com.dt76.smallloanbackendservice.pojo.xm.BeforeOrderQuery;
import com.dt76.smallloanbackendservice.service.xm.BeforeOrderService;
import com.dt76.smallloanbackendservice.utils.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/xm")
public class BeforeOrderController {

    @Resource
    private BeforeOrderService beforeOrderService;

    @PostMapping("/qryPageConditionAll")
    @ResponseBody
    public Page qryPageConditionAll(Integer currentPageNo, @RequestBody BeforeOrderQuery beforeOrderQuery) {
        System.out.println(beforeOrderQuery.toString());
        return beforeOrderService.getAllOrderByPage(currentPageNo, beforeOrderQuery);
    }

    @PostMapping("/qryPageConditionAll2")
    @ResponseBody
    public Page qryPageConditionAll2(Integer currentPageNo, @RequestBody BeforeOrderQuery beforeOrderQuery) {
        System.out.println(beforeOrderQuery.toString());
        return beforeOrderService.getAllOrderByPage2(currentPageNo, beforeOrderQuery);
    }

    @RequestMapping("/BeforeOrder/qryByID")
    @ResponseBody
    public BeforeOrder qryByID(int id) {
        System.out.println(id);
        return beforeOrderService.qryByID(id);
    }

    @PostMapping("/BeforeOrder/modifyBeforeOrderType")
    @ResponseBody
    public int modifyBeforeOrderType(@RequestBody BeforeOrder beforeOrder) {
        return beforeOrderService.modifyBeforeOrderType(beforeOrder);
    }
}
